﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/CRM.Master" CodeBehind="GUsuarios.aspx.cs" Inherits="crm.aplicacao.CRMSystem.GUsuarios" %>

<%@ Register Assembly="Ext.Net.UX" Namespace="Ext.Net.UX" TagPrefix="ux" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <ext:GridPanel ID="GridUsuarios" runat="server" Title="Gerência de Usuários" AutoScroll="true" AutoExpandColumn="nome" Height="600">
        <Store>
            <ext:Store ID="strUsuarios" runat="server">
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="idusuarios" ServerMapping="IdUsuario" />
                            <ext:RecordField Name="nome" />
                            <ext:RecordField Name="login" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <TopBar>
            <ext:Toolbar ID="ToolbarUsuarios" runat="server" AutoWidth="true">
                <Items>
                    <ext:Button ID="btNovoUsuarios" runat="server" Text="Novo" Icon="Add">
                        <Listeners>
                            <Click Handler="#{win}.show()" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="btEditarUsuarios" runat="server" Text="Editar" Icon="PageWhiteEdit">
                        <Listeners>
                            <Click Handler="Ext.net.DirectMethods.editar();" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="btRemoverUsuarios" runat="server" Text="Remover" Icon="Delete">
                        <Listeners>
                            <Click Handler="Ext.net.DirectMethods.remover();" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:Column ColumnID="colUsuarios" Header="Nome" Width="160" DataIndex="nome" />
                <ext:Column ColumnID="colUsuarios" Header="Login" Width="160" DataIndex="login" />
            </Columns>
        </ColumnModel>
        <SelectionModel>
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
        </SelectionModel>
        <BottomBar>
            <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="20" />
        </BottomBar>
        <LoadMask ShowMask="true" />
    </ext:GridPanel>
    <ext:Window ID="win" runat="server" Icon="User" Title="Dados do Usuário" Hidden="true" Modal="true" Width="430" AutoHeight="true" Resizable="false">
        <Items>
            <ext:FormPanel ID="FormNovoUsuarios" runat="server" Padding="5" Layout="Anchor" BodyStyle="background-color: transparent;" Header="false">
                <Items>
                    <ext:TextField ID="txtNomeUsuarios" runat="server" FieldLabel="Nome" AnchorHorizontal="93%" AllowBlank="false" MsgTarget="Side" />
                    <ext:TextField ID="txtEmailUsuarios" runat="server" FieldLabel="Email/Login" AnchorHorizontal="93%" AllowBlank="false" MsgTarget="Side" />
                    <ext:TextField ID="txtSenhaUsuarios" runat="server" FieldLabel="Senha" AnchorHorizontal="93%" AllowBlank="false" MsgTarget="Side" InputType="Password" />
                   <ext:TextField ID="txtConfirmaSenhaUsuarios" runat="server" FieldLabel="Confirmar Senha" AnchorHorizontal="93%" AllowBlank="false" MsgTarget="Side" InputType="Password"/>
                </Items>
                <Buttons>
                    <ext:Button ID="btGravarUsuarios" runat="server" Text="Gravar" Icon="Disk">
                        <Listeners>
                            <Click Handler="Ext.net.DirectMethods.inserir();" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="btCancelar" runat="server" Text="Cancelar" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{win}.hide();" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
        </Items>
        <Listeners>
            <Close Handler="Ext.net.DirectMethods.limparCampo();" />
            <Hide Handler="Ext.net.DirectMethods.limparCampo();" />
        </Listeners>
    </ext:Window>
    <ext:Hidden ID="hdfIdUsuarios" runat="server" />
</asp:Content>
